<template>
  <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="120px">
    <el-row :gutter="15">
      <el-col :span="4">
        <el-form-item label="所属单位：">
          <el-select v-model="formData.ssdw" clearable :style="{width: '100%'}">
            <el-option
              v-for="(item, index) in CompanyList"
              :key="index"
              :label="item.name"
              :value="item.code"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="维护班组：">
          <el-select v-model="formData.whbz" clearable :style="{width: '100%'}">
            <el-option
              v-for="(item, index) in TeamList"
              :key="index"
              :label="item.name"
              :value="item.code"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="电压等级：">
          <el-select v-model="formData.dydj" clearable :style="{width: '100%'}">
            <el-option
              v-for="(item, index) in VoltageList"
              :key="index"
              :label="item.name"
              :value="item.code"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="变电站：">
          <el-select
            v-model="formData.bdz"
            filterable
            clearable
            :style="{width: '100%'}"
            @change="handelChange"
          >
            <el-option
              v-for="(item, index) in bdz"
              :key="index"
              :label="item.name"
              :value="item.code"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="区域/房间：" prop="station">
          <el-input v-model="formData.area" clearable :style="{width: '100%'}"></el-input>
        </el-form-item>
      </el-col>

      <el-col :span="4">
        <el-form-item label="所属子系统：">
          <el-select v-model="formData.ssxt" clearable :style="{width: '100%'}">
            <el-option
              v-for="(item, index) in sysId_options"
              :key="index"
              :label="item.name"
              :value="item.code"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="设备名称：" prop="station">
          <el-input v-model="formData.sbmc" clearable :style="{width: '100%'}"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="是否报警：">
          <el-select v-model="formData.sfbj" clearable :style="{width: '100%'}">
            <el-option
              v-for="(item, index) in dqzt"
              :key="index"
              :label="item.name"
              :value="item.code"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="4" :offset="12" class="endbox">
        <el-button type="primary" @click="handel">查询</el-button>
        <el-button type="primary" @click="reset">重置</el-button>
      </el-col>
    </el-row>
  </el-form>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { JointInspectionModule } from "@/store/modules/JointInspection";
import { publicAPIModule } from "@/store/modules/public";
@Component
export default class extends Vue {
  formData: any = {
    ssdw: "",
    whbz: "",
    dydj: "",
    bdz: "",
    area: "",
    ssxt: "",
    sbmc: "",
    sfbj: "",
  };
  rules = {};
  // 下拉框变电站
  get SubstationList() {
    let SubstationList = JointInspectionModule.LocalCityList || [];
    return SubstationList;
  }
  get TeamList() {
    return publicAPIModule.TeamList;
  }
  get CompanyList() {
    console.log(publicAPIModule.CompanyList);

    return publicAPIModule.CompanyList;
  }
  get VoltageList() {
    return publicAPIModule.VoltageList;
  }
  sysId_options = [
    // {name:'全部',code:''},
    { name: "消防系统", code: "xfxt" },
    { name: "安防系统", code: "afxt" },
    { name: "环境监测", code: "hjjc" },
    { name: "在线监测", code: "zxjc" },
    { name: "照明系统", code: "zmxt" },
  ];
  dqzt = [
    { name: "全部", code: "" },
    { name: "是", code: "1" },
    { name: "否", code: "0" },
  ];
  get bdz() {
    return publicAPIModule.SubstationList;
  }
  stationList = [];
  handel() {
    this.$emit("formSearch");
  }
  handelChange(val) {
    this.$emit("formSearch", val);
  }
  reset() {
    this.formData = {};
  }
  mounted() {
    this.formData.ssxt = this.$route.query.ssxt || "";
    this.handel();
  }
}
</script>

<style lang="scss" scoped>
</style>

